import {ref,onMounted,onUnmounted} from 'vue'


const vw=ref(document.documentElement.clientWidth)
const vh=ref(document.documentElement.clientHeight)
export function useViewport(){
    function resize(){
        vw.value=document.documentElement.clientWidth
        vh.value=document.documentElement.clientHeight
    }
    onMounted(()=>{
        window.addEventListener('resize',resize)
    })
    onUnmounted(()=>{
        window.removeEventListener('resize',resize)
    })
    return {vw,vh}
}